class_name PlayerUpState
extends GameplayState

var animation_name: String = "up"

@onready var player: Player = $"../../../"


func _on_enter() -> void:
	player.play_animation(animation_name)
	player.weapon.play_animation(animation_name)
	
	player.add_tag(GameplayTagLibrary.State_Air_Up)


func _on_update(delta: float) -> void:
	var jump_height: float = player.get_attribute("jump_height").current_value
	var jump_time_to_peak: float = player.get_attribute("jump_time_to_peak").current_value
	var jump_gravity: float = ((2.0 * jump_height) / (jump_time_to_peak * jump_time_to_peak))
	player.velocity.y += jump_gravity * delta


func _on_exit() -> void:
	player.remove_tag(GameplayTagLibrary.State_Air_Up)
